import { VxeGridProps } from 'vxe-table';
import { StationEnergyRecord } from '@/api/station/energy/types';

export function getTableConfig(): VxeGridProps<StationEnergyRecord> {
  return {
    id: 'tenant',
    loading: false,
    height: '500px',
    autoResize: true,
    border: 'inner',
    resizable: true,
    showOverflow: 'tooltip',
    stripe: true,
    rowConfig: {
      isHover: true,
      keyField: 'id'
      // height: 56
    },
    customConfig: {
      storage: true
    },
    columns: [
      {
        sortable: true,
        field: 'endTo',
        title: '起止时间',
        minWidth: '160px',
        formatter: ({ row }) => (row.startFrom ? row.startFrom + '~' + row.endTo : '-')
      },
      { sortable: true, field: 'settleStatus', title: '结算状态', slots: { default: 'status' } },
      { sortable: true, field: 'meterReadingCurrent', title: '电表读数' },
      { sortable: true, field: 'amount', title: '电量' },
      { sortable: true, field: 'electricityPrice', title: '金额' },
      { sortable: true, field: 'createTime', title: '登记时间' },
      { sortable: true, field: 'createByName', title: '登记人' },
      { sortable: true, field: 'handle', title: '操作', width: '140px', slots: { default: 'handle' } }
    ],
    data: [] as StationEnergyRecord[]
  };
}
